package com.neutech.terrain;

import com.neutech.Util.ImageUtils;
import com.neutech.base.Drawable;
import com.neutech.base.Sprite;
import com.neutech.base.TankMap;
import com.neutech.frame.TankFrame;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Prop extends Sprite implements Drawable {
    public transient List<Image> imageList = new ArrayList<>();
    public TankMap tankMap ;//这是新对象，新对象肯定是一直的值，只能在tankframe里面间接调
    public Prop(int x, int y, int width, int height) {
        super(x, y, width, height);
       this.loadingImg();
    }


    public int index;


    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    @Override
    public void draw(Graphics g) {

        System.out.println(getIndex());

        g.drawImage(imageList.get(getIndex()),getX(),getY(),null);
    }

    @Override
    public Rectangle getRectangle() {
        return new Rectangle(getX(),getY(),getWidth(),getHeight());
    }

    private void loadingImg(){
        imageList.add(ImageUtils.getValue("prop_01"));
        imageList.add(ImageUtils.getValue("prop_02"));
        imageList.add(ImageUtils.getValue("prop_03"));
        imageList.add(ImageUtils.getValue("prop_04"));
        imageList.add(ImageUtils.getValue("prop_05"));
        imageList.add(ImageUtils.getValue("prop_06"));
        imageList.add(ImageUtils.getValue("prop_07"));
        imageList.add(ImageUtils.getValue("prop_08"));
        imageList.add(ImageUtils.getValue("prop_09"));
        imageList.add(ImageUtils.getValue("prop_10"));
        imageList.add(ImageUtils.getValue("prop_11"));

    }
}
